package cn.media

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.rdd.RDD

object Demo {

  def main(args: Array[String]): Unit = {

    if(args.length!=1){
      println(
        """
          |参数：
          |inputpath
          |""".stripMargin)
      sys.exit()
    }
    val Array(inputpath) = args

    val conf: SparkConf = new SparkConf().setAppName("Demo").setMaster("local[*]")
    val sc: SparkContext = new SparkContext(conf)
    sc.textFile(inputpath)
    .map(line => line.split(",", -1)).filter(_.length >= 85)
      .map(arr => ((arr(13), arr(14)), 1))
      .reduceByKey(_ + _)
      .map(t => t._1._1+","+t._1._2+","+t._2)
      .saveAsTextFile("D:\\logs\\ac")





sc.stop()
  }


}
